package com.loan.controller.common;

import com.loan.system.service.ApplyService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.apache.commons.codec.digest.Md5Crypt;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Api(value = "omipay代收管理", tags = {"omipay代收管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/omipay")
public class OMIPayController {

    private final ApplyService applyService;

    /**
     * 代收回调
     * @return
     */
    @GetMapping("/payment/callback")
    public String paymentCallBack(HttpServletRequest request){
        String vaAccount = request.getParameter("va_account");
        String amount = request.getParameter("amount");
        String orderId = request.getParameter("order_id");
        String cashin = request.getParameter("cashin");
        String errorCode = request.getParameter("error_code");
        String secureCode = request.getParameter("secure_code");

        return applyService.updateApplyByMsg(request);
    }
}
